#include <string_view>
#include <vector>


namespace rdhttp {
    std::vector<std::string_view> split(std::string_view content, std::string_view _split) {
        std::vector<std::string_view> list;
        std::string_view::size_type pos_start = 0;
        while (1) {
            auto pos = content.find(_split, pos_start);
            if (pos == std::string_view::npos) {
                if (pos_start < content.size()) {
                    list.push_back(content.substr(pos_start));
                }
                break;
            }
            if (pos == 0) {
                pos_start += _split.size();
                continue;
            }

            list.push_back(content.substr(pos_start, pos - pos_start));
            pos_start = pos + _split.size();
            if (pos_start > content.size()) break;
        }
        return list;
    }

}  // namespace rdhttp
